import Vue from 'vue'
import Router from 'vue-router'
//登录界面
import Login from '@/components/index/Login'
//消息界面
import MainIndex from '@/components/messages/Index'
//好友
import FriendList from '@/components/friend/Index'
//工作台
import Work from '@/components/works/Work'
//用户信息
import UserMain from '@/components/usermain/UserMain'
//知识台
import Learn from '@/components/knowledge/Learn'
//文件列表
import  FileItem from  '@/components/fileconsole/FileItem'
//工作日志
import WorkRecord from '@/components/workRecord/Index'
//添加日志
import RecordAdd from '@/components/workRecord/RecordAdd'
//考勤
import Punch from '@/components/punch/Index'
//便签
import Memo from '@/components/memo/Index'
//会议室
import MeetingRoom from '@/components/conference/Index'
//会议室详情
import RoomDetail from '@/components/conference/RoomDetail'
//笔记
import Notes from '@/components/notes/Index'
//文件管理
import FilePage from '@/components/fileconsole/Index'

Vue.use(Router);

const router = new Router({
	mode: 'hash',
	routes: [
		{path: '/', component: Work},
		{path: '/Login', component: Login},
		{path: '/MainIndex', component: MainIndex},
		{path: '/FriendList', component: FriendList},
		{path: '/Work',component: Work},
		{path: '/Learn', component: Learn},
		{path: '/UserMain', component: UserMain},
		{path: '/FilePage', component: FilePage},
    {path:'/FileItem',component:FileItem},
    {path:'/WorkPage',component:WorkRecord},
    {path:'/RecordAdd',component:RecordAdd},
    {path:'/PunchPage',component:Punch},
    {path:'/MemoPage',component:Memo},
    {path:'/MeetingPage',component:MeetingRoom},
    {path:'/RoomDetail',component:RoomDetail},
    {path:'/NotesPage',component:Notes}
	]
});
//路由守卫
router.beforeEach(function(to, from, next){
//	var token = localStorage.getItem("appUserToken");
//	console.log(to.path);
//	if (to.path == '/Login' || to.path == '/') {
//		if(token == '' || token == null || token == 'undefined'){
//			localStorage.setItem("appUserToken", "");
//			next();
//		}else{
//			next({path: '/MainIndex'});
//		}
//	} else{
//		//是否在登录状态下
//		if(token == '' || token == null || token == 'undefined'){
//			next({path: '/Login'});
//		}else{
			next();
//		}
//	}
});
export default router;
